DO WHILE .T.
   NUM=ST_MAX-ST_ACT_BUY
   NUMX=ST_MAX-ST_ACT_BUY
   @ 13,  2  SAY  KODE
   @ 13,  8  SAY  alltrim(NAME)+' '+alltrim(tipe)+' '+alltrim(qant)+' '+alltrim(unit)
   @ 13, 50  SAY  ST_MAX
   @ 13, 59  SAY  ST_REFIL
   @ 13, 69  SAY  ST_ACT_BUY
  IF BUY_SELL_R<>1
     @ 14,  8  SAY  ALLTRIM(BUY_UNIT)+' of '+ALLTRIM(STR(BUY_SELL_R))+' '+SELL_UNIT
  ELSE
     @ 14,  8  SAY  BUY_UNIT
  ENDIF
  @ 15,24 clea to 18,78
  @ 18,1 clea to 23,78
  ORD='Y'
  DO WHILE .T.
     @ 16,20 GET ORD PICT '@!'
     READ
     PRS=LASTKEY()
     IF PRS=27
        BACK='Y'
        RETURN
     ENDIF
     IF ORD='Y' .OR. ORD='N'
        EXIT
     ENDIF
     LOOP
  ENDDO
  IF ORD='N'
     RETURN
  ELSE
     @ 18,1 CLEA TO 20,78
     @ 18,  1  TO 20, 78    DOUBLE
     @ 21,  1  TO 23, 30    DOUBLE
     @ 19,  3  SAY "QUANTITY :           UNIT PRICE :                DISCOUNT :       %"
     @ 22,  3  SAY "VALUE    :"
     PRIC=0
     DISC=0
     QORD=ST_MAX-ST_ACT_BUY
        do while .T.
           @ 19,15 GET NUM PICT '9,999'
           read
*           IF NUM>QORD .OR. NUM<=0
           IF NUM<=0
              num=numx
            loop
           ENDIF
           EXIT
        enddo
     do while pric=0
        @ 19,38 GET PRIC PICT '99,999,999.99'
        read
        loop
     enddo
     @ 19,63 GET DISC PICT '99.99'
     READ
     VALDISC=DISC/100*PRIC
     NETPRIC=PRIC-VALDISC
     VALU=NUM*NETPRIC
     @ 22,15 SAY VALU PICT '99,999,999.99'
     @ 21, 40 TO 23, 78    DOUBLE
     @ 22, 42  SAY "Confirm -->> Enter   Cancel -->> F4"
     STORE 0 TO MX
     DO WHILE MX=0
        MX=INKEY()
     ENDDO
      DO CASE
         CASE MX=-3
            @ 16,31 CLEA TO 18,78
            @ 19,01 CLEA TO 23,78
            LOOP
         CASE MX=13
*            @ 21 ,41 clea to 23,78
 *           @ 21, 41 TO 23, 65    DOUBLE
 *           @ 22, 43 SAY "SELECTION OF SUPPLIER"
*            SET CONS OFF
*            WAIT
*            SET CONS ON
            RETURN
      ENDCASE
   ENDIF
ENDDO
